package com.kookapi.controller;

import com.kookapi.common.core.controller.BaseController;
import com.kookapi.common.core.domain.AjaxResult;
import com.kookapi.dto.TaskRequestDTO;
import com.kookapi.service.AllureReportService;
import com.kookapi.service.TestCoreService;
import org.springframework.web.bind.annotation.*;

/**
 * @author bairimengchang
 * @version 1.0
 * @project kookapi
 * @description 测试核心控制器
 * @date 2025/10/8
 */
@RestController
@RequestMapping("/core")
public class TestCoreController extends BaseController {

    private final TestCoreService testCoreService;

    public TestCoreController(TestCoreService testCoreService) {
        this.testCoreService = testCoreService;
    }

    /**
     * TODO执行测试任务（先按传入场景id写，之后改成任务id）
     * 反正针对任务，我可以在前端展示任务进度，任务完成后，让前端按钮直接访问生成的报告即可
     */
    @PostMapping("/executeTestTask")
    public AjaxResult executeTestTask(@RequestBody TaskRequestDTO taskRequestDTO){
        System.out.println("执行测试任务");
        return toAjax(testCoreService.executeTestTask(taskRequestDTO));
    }

}
